<template>
  <el-drawer v-model="isVisible" size="40%">
    <template #title>
      <h2 style="color: #f58147; font-weight: bold;">菜品详情</h2>
    </template>
    <el-form label-position="right" label-width="100px" style="padding: 0 20px;">
      <el-row :gutter="20">
        <el-col :span="24">
          <el-form-item label="菜品编号">
            <el-input v-model="caipin.cpid" disabled style="background-color: #fff;"/>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="菜品名称">
            <el-input v-model="caipin.cpmc" disabled style="background-color: #fff;"/>
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="菜品销量">
            <el-input v-model="caipin.count" disabled style="background-color: #fff;"/>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </el-drawer>
</template>


<script setup lang="ts">
import {ref} from "vue";

const caipin = ref({
  cpid:'',
  cpmc:'',
  count:'',
})

const isVisible = ref(false)
function handleDetailData(obj){
  caipin.value = obj;
  isVisible.value = true;
}
//暴露给父组件
defineExpose ({
  handleDetailData
})
</script>

<style scoped>
:deep(.el-drawer__body) {
  padding: 20px;
}

.el-form-item__content {
  width: 100%;
}

.el-input__inner {
  border-radius: 6px;
  border: 1px solid #e4e7ed;
  padding: 10px;
  transition: all 0.3s ease;
}

.el-input__inner:focus {
  border-color: #f58147;
  box-shadow: 0 0 5px rgba(245, 129, 71, 0.3);
}

.el-drawer {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  overflow: hidden;
}

h2 {
  margin: 0;
  font-size: 18px;
  color: #f58147;
  font-weight: 600;
}
</style>
